const Koa = require('koa')

const router = require("koa-router")()

const views = require('koa-views')

// 主要是 针对 history 路由  锚点路由 可删除
const { historyApiFallback } =  require('koa2-connect-history-api-fallback')


const app = new Koa()
// 主要是 针对 history 路由  锚点路由 可删除
app.use(historyApiFallback())

app.use(views(__dirname+"/dist"))

app.use(require('koa-static')(__dirname+'/dist'))

router.get('/',async (ctx,next)=>{
    await ctx.render('index')
})

app.use(router.routes())

app.listen(3000)
console.log('localhost:3000')